# -*- coding:utf-8 -*-
import pymysql
def mysql_conn(dbhost,dbusername,dbpassword,dbname):
    conn = pymysql.connect(dbhost,dbusername,dbpassword,dbname)
    return conn
def insert_data_to_table():
    dbhost = "120.24.154.123"
    dbusername = "ibd"
    dbpassword = "tiIXSUYjR4tZAOnQ"
    dbname = "secritygroup"
    conn = mysql_conn(dbhost,dbusername,dbpassword,dbname)
    cursor = conn.cursor()
    insert_into_table_prefix = "INSERT INTO"
    insert_into_table_name = "boofoo_dz_data"
    field = "member_id"
    sql = """INSET INTO boofoo_dz_data(member_id,terminal_id,transaction_type,transaction_subordinate_type,total_num,total_amount,total_service_cost,liquidation_date) VALUES ("100000178","10000001","01311","","120","51312726.07","972.00","2018-03-26")"""
    #insert_color = (" (,terminal_id,transaction_type,transaction_subordinate_type,total_num,total_amount,total_service_cost,liquidation_date)" "values(%s,%s,%s,%s,%s,%s,%s,%s)")
    cursor.execute(sql)




fd = open("e:\\fi_dz_100000178_2018-03-26_new.txt",'r',encoding="gbk")
for line in fd.readlines():
    line = str(line).strip().split("|")
    # line.append("NULL")
    print(len(line))
    print(line)
    #insert_data_to_table()

    break
